package com.zh.rent.comm;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("classpath:static/").
                addResourceLocations("file:static/");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //WebMvcConfigurer.super.addInterceptors(registry);
        Interceptor1 loginInterceptor= new Interceptor1();
       /* registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/img/**","/index",
                "/public/**").excludePathPatterns("/view/login", "/view/buy",
                "/view/gmjl","/view/xufei","/view/new","/view/return").excludePathPatterns("/buy/**","/guide/**","/selVoucherInv/**");*/
        registry.addInterceptor(loginInterceptor).addPathPatterns("/view/dating.html","/account/allocation");

        Interceptor2 interceptor2 = new Interceptor2();
        registry.addInterceptor(interceptor2).addPathPatterns("/houtai/index.html");

    }
}
